// TODO: CODE REVIEW & CLEANUP!
//
// Icons.cs
//
// Implement *Icon classes, which are simple controls that simply display a static graphic.
//
// Note: instead of LineUpIcon/LineDownIcon/PageUpIcon/PageDownIcon, I tried just using e.g.
//
//     <Path Style="LineUpIcon">
//
// ...where LineUpIcon was defined as follows:
//
//     <Style TargetType="Path" x:Key="LineUpIcon">
//         <Setter Property="Data" Value="M 9,0 l 9,14 l -5,0 l 0,16 l -8,0 l 0,-16 l -5,0 Z" />
//         <Setter Property="Fill" Value="#A1ACB7" />
//	   </Style>
//
// This worked... the first time.  The second time the Path was instantiated, I got an exception.
// I don't think Silverlight likes Data being re-used.  So, I made these "icons" be trivial
// controls instead.
//

using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace HomeUX.Controls
{

public class HomeIcon : Control
{
    public static readonly DependencyProperty ScaleProperty =
        DependencyProperty.Register("Scale", typeof(double), typeof(HomeIcon), null);

    public double Scale
    {
        get
        {
            return (double)GetValue(ScaleProperty);
        }
        set
        {
            SetValue(ScaleProperty, value);
        }
    }

    public HomeIcon()
    {
        DefaultStyleKey = typeof(HomeIcon);
    }

    public override void OnApplyTemplate()
    {
        base.OnApplyTemplate();

        // oddly, "{TemplateBinding Scale}" doesn't seem to work in Generic.xaml -- this is the
        // workaround
        var transform = (ScaleTransform) GetTemplateChild("ScaleTransform");
        transform.ScaleX = transform.ScaleY = Scale;
    }
}

public class WaitIcon : Control
{
    public WaitIcon()
    {
        DefaultStyleKey = typeof(WaitIcon);
    }
}

public class WaitIcon2 : Control
{
    public WaitIcon2()
    {
        DefaultStyleKey = typeof(WaitIcon2);
    }
}

public class LineUpIcon : Control
{
    public LineUpIcon()
    {
        DefaultStyleKey = typeof(LineUpIcon);
    }
}

public class LineDownIcon : Control
{
    public LineDownIcon()
    {
        DefaultStyleKey = typeof(LineDownIcon);
    }
}

public class PageUpIcon : Control
{
    public PageUpIcon()
    {
        DefaultStyleKey = typeof(PageUpIcon);
    }
}

public class PageDownIcon : Control
{
    public PageDownIcon()
    {
        DefaultStyleKey = typeof(PageDownIcon);
    }
}

public class InformationIcon : Control
{
    public InformationIcon()
    {
        DefaultStyleKey = typeof(InformationIcon);
    }
}

public class WarningIcon : Control
{
    public WarningIcon()
    {
        DefaultStyleKey = typeof(WarningIcon);
    }
}

public class PlayIcon : Control
{
    public PlayIcon()
    {
        DefaultStyleKey = typeof(PlayIcon);
    }
}

public class PauseIcon : Control
{
    public PauseIcon()
    {
        DefaultStyleKey = typeof(PauseIcon);
    }
}

public class StopIcon : Control
{
    public StopIcon()
    {
        DefaultStyleKey = typeof(StopIcon);
    }
}

public class FastForwardIcon : Control
{
    public FastForwardIcon()
    {
        DefaultStyleKey = typeof(FastForwardIcon);
    }
}

public class RewindIcon : Control
{
    public RewindIcon()
    {
        DefaultStyleKey = typeof(RewindIcon);
    }
}

public class MaxFastForwardIcon : Control
{
    public MaxFastForwardIcon()
    {
        DefaultStyleKey = typeof(MaxFastForwardIcon);
    }
}

public class MaxRewindIcon : Control
{
    public MaxRewindIcon()
    {
        DefaultStyleKey = typeof(MaxRewindIcon);
    }
}

public class PreviousTrackIcon : Control
{
    public PreviousTrackIcon()
    {
        DefaultStyleKey = typeof(PreviousTrackIcon);
    }
}

public class NextTrackIcon : Control
{
    public NextTrackIcon()
    {
        DefaultStyleKey = typeof(NextTrackIcon);
    }
}

public class RecordIcon : Control
{
    public RecordIcon()
    {
        DefaultStyleKey = typeof(RecordIcon);
    }
}

public class LeftArrowIcon : Control
{
    public LeftArrowIcon()
    {
        DefaultStyleKey = typeof(LeftArrowIcon);
    }
}

public class RightArrowIcon : Control
{
    public RightArrowIcon()
    {
        DefaultStyleKey = typeof(RightArrowIcon);
    }
}

public class UpArrowIcon : Control
{
    public UpArrowIcon()
    {
        DefaultStyleKey = typeof(UpArrowIcon);
    }
}

public class DownArrowIcon : Control
{
    public DownArrowIcon()
    {
        DefaultStyleKey = typeof(DownArrowIcon);
    }
}

public class NoAlbumArtIcon : Control
{
    public static readonly DependencyProperty ScaleProperty =
        DependencyProperty.Register("Scale", typeof(double), typeof(NoAlbumArtIcon), null);

    public double Scale
    {
        get
        {
            return (double)GetValue(ScaleProperty);
        }
        set
        {
            SetValue(ScaleProperty, value);
        }
    }

    public NoAlbumArtIcon()
    {
        DefaultStyleKey = typeof(NoAlbumArtIcon);
    }

    public override void OnApplyTemplate()
    {
        base.OnApplyTemplate();

        // oddly, "{TemplateBinding Scale}" doesn't seem to work in Generic.xaml -- this is the
        // workaround
        var transform = (ScaleTransform)GetTemplateChild("ScaleTransform");
        transform.ScaleX = transform.ScaleY = Scale;
    }
}

}

